import processing.opengl.*;
import penner.easing.*;

PFont font;
ToolTip t;
Thing th;

void setup() 
{
  size(500, 900, OPENGL);
  frameRate(60);
  background(102);


  font = loadFont("Serif-10.vlw");
  String lines[] = loadStrings("license.txt");
  String txt = join(lines,"\n");
  //t = new ToolTip(txt);
  t = new ToolTip("TEST\n1234\n1234 1234 12345 6789 skfjskdfjskdfjks jf skjf ksj dfksjdkfjskdfjs kdfjsdjasdk\nkj dskjdf sdkfjs df");
  th = new Thing();
  t.followThing(th);
}

void draw() {
  background(0);
  
  fill(0);
  t.draw();
  
  th.tick();
  th.draw();
}


void mousePressed() {
    t.setVisible(true);    
}
void mouseReleased() {
    t.setVisible(false);     
}


class Thing{
  float x,y; 
  Thing(){
    x = 0;
    y = 100;
  }
  void tick(){
    if (x > 300) {
      x = 0;
    }else {
      x+=.5;
    }
    y = Cubic.easeIn(x, 50, 100, 300);
  }
  
  void draw(){
    pushMatrix();
    translate(x,y);
    fill(100);
    beginShape(QUADS);
    vertex(-2,-2);
    vertex(2,-2);
    vertex(2,2);
    vertex(-2,2);
    endShape();
    popMatrix();
  }
}
